home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Tutorial / Cookbook / 42.DocApp / DocApp.m < prev    next >
Text File  |  1995-06-12  |  810b  |  45 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "DocApp.h"
  5. #import "Document.h"
  6. #import <appkit/defaults.h>
  7. #import <appkit/OpenPanel.h>
  8. #import <appkit/SavePanel.h>
  9.  
  10. @implementation DocApp
  11.  
  12. - newDocument:sender
  13. {
  14.     [Document new];
  15.     if (DEBUGGING) printf("in DocApp new.\n");
  16.     return self;
  17. }
  18.  
  19. - openDocument:sender
  20. {
  21.     static char *const docTypes[] = {FILEEXT, NULL};
  22.     
  23.     if ([[self openPanel] runModalForTypes:docTypes])
  24.         if ([Document newFromFile:[[self openPanel] filename]] == nil)
  25.             NXRunAlertPanel (NULL, "Could not open file.", "OK", NULL, NULL);
  26.     return self;
  27. }
  28.  
  29. // Outlet Initialization
  30.  
  31. - openPanel
  32. {
  33.     if(!openPanel) openPanel = [OpenPanel new];
  34.     return openPanel;
  35. }
  36.  
  37. - savePanel
  38. {
  39.     if(!savePanel) savePanel = [SavePanel new];
  40.     [savePanel setRequiredFileType:FILEEXT];
  41.     return savePanel;
  42. }
  43.  
  44. @end
  45.